const { DataTypes } = require("sequelize");
const seq = require("../db/seq.js");
const Gaojings = seq.define(
  "gaojings",
  {
    gaojingId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      comment: "详情ID",
    },
    linkId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "标志ID",
    },
    linkName: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "详情键名",
    },
    lineName:{
      type:DataTypes.STRING(50),
      allowNull:false,
      defaultValue:"",
      comment:"链路名称"
    },
    status:{
      type:DataTypes.STRING(10),
      allowNull:false,
      defaultValue:"正常",
      comment:"线路状态"
    },
    statusValue:{
      type:DataTypes.STRING(30),
      allowNull:false,
      defaultValue:"",
      comment:"状态值"
    },
    times: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue: 0,
      comment: "故障时间",
    },
    endtimes: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue: 0,
      comment: "解故障时间",
    },
    works:{
      type:DataTypes.STRING(400),
      allowNull:false,
      defaultValue:"[]",
      comment:"业务名称，是来个JSON格式字符串，默认是一个空数组"
    },
    cancat:{
      type:DataTypes.STRING(30),
      allowNull:false,
      defaultValue:"",
      comment:"联系人信息"
    },
    origin:{
      type:DataTypes.STRING,
      allowNull:false,
      defaultValue:"",
      comment:"启始故障点"
    },
    originId:{
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "故障起始点ID",
    },
    finishing:{
      type:DataTypes.STRING,
      allowNull:false,
      defaultValue:"",
      comment:"故障结束点"
    },
    finishingId:{
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "故障结束点ID",
    },
    distance:{
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 0,
      comment: "距离",
    },
    describe:{
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 0,
      comment: "描述",
    },
    X:{
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 0,
      comment: "X",
    },
    Y:{
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 0,
      comment: "Y",
    },
    longitude: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "经度",
    },
    latitude: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "纬度",
    },
    gaojingType:{
      type:DataTypes.TINYINT,
      allowNull:false,
      defaultValue:1,
      comment:"告警类型，1为真实告警,0为模拟告警"
    }
  },
  {
    freezeTableName: true,
    timestamps: false,
  }
);
module.exports = Gaojings;